<?php

App::uses('AppController', 'Controller');

class SheetsController extends AppController {

	public $name = 'Sheets';

	public function index() {
            $this->set('sheets', $this->Sheet->find('all'));
	}
        
        public function show() {
            
	}
        
        public function add() {
            $this->set('title_for_layout', 'New expensive sheet');
            
            if ($this->request->is('post')) {
                if ($this->Sheet->save($this->request->data)) {
                    $this->Session->setFlash('Sheet has been created');
                    $this->redirect(array('action' => 'index'));
                } else {
                    $this->Session->setFlash('An error has occured when creating sheet');
                }
            }
            
	}
}